package cn.cheln.support.images;

import cn.cheln.explorer.beans.FileInfo;
import cn.cheln.explorer.beans.FileUtil;
import java.io.File;

public class MimeUtil
{
  public static final FileTypeInfo isTypeFromMime(String paramString, FileTypeInfo[] paramArrayOfFileTypeInfo)
  {
    String[] arrayOfString;
    int j;
    String str1 = parseMime(FileUtil.getName(paramString));
    if ((str1 == null) || (str1.trim().equals("")))
    {
      localFileTypeInfo = new FileTypeInfo(FileCategoryHelper.FileCategory.NoType, FileInfo.iconDoc, null);
      return localFileTypeInfo;
    }
    int i = 0;
    if (i >= paramArrayOfFileTypeInfo.length)
      return new FileTypeInfo(FileCategoryHelper.FileCategory.NoRecorded, FileInfo.iconDoc, null);
    FileTypeInfo localFileTypeInfo = paramArrayOfFileTypeInfo[i];
    if (localFileTypeInfo != null)
    {
      arrayOfString = localFileTypeInfo.mimes;
      j = arrayOfString.length;
    }
    for (int k = 0; ; ++k)
    {
      if (k >= j)
        ++i;
      String str2 = arrayOfString[k];
      if (str1.trim().toUpperCase().startsWith(str2.toUpperCase()));
    }
  }

  public static final String parseMime(File paramFile)
  {
    return parseMime(paramFile.getName());
  }

  public static final String parseMime(String paramString)
  {
    return parseWholeMime(FileUtil.getRealExtension(paramString));
  }

  public static final String parseMimeFromExt(String paramString)
  {
    if ((paramString == null) || (paramString.trim().equals("")))
      return "";
    String str = MimeTypeMap.getSingleton().getMimeTypeFromExtension(paramString.toLowerCase());
    if (str == null)
      return "";
    return str.split("/")[0];
  }

  public static final String parseMimeFromPath(String paramString)
  {
    return parseMime(FileUtil.getName(paramString));
  }

  public static final String parseWholeMime(String paramString)
  {
    if (paramString.equals(""))
      return "";
    return MimeTypeMap.getSingleton().getMimeTypeFromExtension(paramString.toLowerCase());
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.support.images.MimeUtil
 * JD-Core Version:    0.5.2
 */